package com.example.mqcummter.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import com.example.mqcummter.entity.BikebaseinfoEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface BikeMapper extends BaseMapper<BikebaseinfoEntity> {

    @Select("select * from bikebaseinfo_copy2 limit 500")
    List<BikebaseinfoEntity> list();


    @Select(" select a.id  from (SELECT id,tables,create_time as createTime from relation  where is_delete=0 and tables=#{tables} ORDER BY create_time desc limit 5000) a GROUP BY a.id")
    List<String> getRealtion(String tables);

    @Select("select * from bikebaseinfo_copy2 where id=#{testMessage} ")
    BikebaseinfoEntity getById(String testMessage);

    @Update("update relation set is_delete=1 where tables='bikebaseinfo' and id=#{testMessage} ")
    Integer deleteRealtion(String testMessage);
}
